home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/clib/h/RCS/setjmp,v $
- * $Date: 1996/10/30 21:58:58 $
- * $Revision: 1.2 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: setjmp,v $
- * Revision 1.2 1996/10/30 21:58:58 unixlib
- * Massive changes made by Nick Burret and Peter Burwood.
- *
- * Revision 1.1 1996/04/19 21:02:57 simon
- * Initial revision
- *
- ***************************************************************************/
-
- /* ANSI Standard 4.6: Non-Local Jumps <setjmp.h>. */
-
- #ifndef __SETJMP_H
- #define __SETJMP_H
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #ifdef __JMP_BUF_SIZE
- #if __JMP_BUF_SIZE < 23
- #undef __JMP_BUF_SIZE
- #endif
- #endif
-
- #ifndef __JMP_BUF_SIZE
- #define __JMP_BUF_SIZE 23
- #endif
-
- typedef int jmp_buf[__JMP_BUF_SIZE];
-
- /* See Norcroft setjmp.h for reason */
- #ifdef __STDC__
- /* -pcc mode doesn't allow circular definitions... */
- #define setjmp(jmp_buf) (setjmp(jmp_buf))
- #endif
-
- extern int setjmp (jmp_buf);
- extern void longjmp (jmp_buf,int);
-
- #if 0
-
- /* POSIX details. */
- #ifndef __SIGNAL_H
- #include <signal.h>
- #endif
-
- /* Calling environment, plus possibly a saved signal mask. */
- typedef struct
- {
- /* Calling environment. */
- jmp_buf __jmpbuf;
- /* Saved the signal mask ? */
- int __mask_was_saved;
- sigset_t saved_mask;
- } sigjmp_buf[1];
-
- /* Store the calling environment in env, also saving the
- signal mask if savemask is nonzero. */
- extern void __sigjmp_save (sigjmp_buf env, int savemask);
-
- /* Similar to setjmp. If save sigs is nonzero, the set of
- blocked signals is saved in state and will be restored
- if a siglongjmp is later performed with this state. */
- extern int sigsetjmp (sigjmp_buf state, int savesigs);
-
- #define sigsetjmp(env, savemask) \
- (__sigjmp_save ((env), (savemask)), setjmp ((env)[0].__jmpbuf))
-
- /* Jump to the environment saved in env, making the sigsetjmp
- call there return val, or 1 if val is 0. Restore the signal
- mask if that sigsetjmp call saved it. */
- extern void siglongjmp (const sigjmp_buf env, int val);
-
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-